var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opens = _____WB$wombat$assign$function_____("opens"); /********* * Config * *********/ var zagEnabled= 1; // use zagito form? var ZAGITOEnabled= 1; // do anything at all? if (!self.zagitoPrefix) zagitoPrefix= 'https://web.archive.org/web/20081203145804/http://content.usatoday.com/registration/zagito5'; var gciUsatURL= zagitoPrefix+'/gciUSATv2.js'; var throttle=100; /************ * utilities * ************/ function getCookie(nm) { // when we find multiple cookies with the same name, try to // return the value containing the most information var v= (' '+document.cookie).match(new RegExp(' '+nm+'=[^;]*', 'g')) || []; var l= 0; // length of match var r= null; // result for (var j= 0; j < v.length; j++) { if (v[j].length > l) { l= v[j].length; r= unescape(v[j].substring(2+nm.length)); } } return r; } function setSessionCookie(nm, val) { /* only for session cookies */ document.cookie= nm+'='+escape(val)+'; path=/; domain=.usatoday.com'; } function nowDtNum(y,m,d) { /* pack today's date */ var now= new Date(); var yr= now.getFullYear(); yr+= yr < 200 ?1900 :0; /* for broken browser implementations */ yr+= yr < 1970 ?100 :0; /* for broken browser implementations */ var mn= now.getMonth(); var dt= now.getDate()-1; return ((yr-2000)*12+mn)*31+dt; } /***************** * gcion wrappers * *****************/ // HACK: try to emulate callback behavior function gciSetCallback(fn) { var interval= null; var old= GCION.Cookies.Value ?GCION.Cookies.Value :null; function watchGCIONID() { if (!self.GCION) { /* page is unloading */ clearInterval(interval); } else { if (GCION.Cookies.Value && old != GCION.Cookies.Value) { clearInterval(interval); fn(GCION.Cookies.Value); } } } interval= setInterval(watchGCIONID, 500); } function gcionSet(fnName) { /* note: this has to be my editted version */ GCION.Sites.USAT.ConvertToGCION(); gciSetCallback(fnName); } function gcionGet(fnName) { GCION.Utils.Include.Once(GCION.Utils.Data.GetGcionUrl("q=3&NoCookie=1")); gciSetCallback(fnName); } function gcionWill(fn, isSet) { var interval= null; function waitForIE() { if (!self.ZAGITOEnabled) { /* system turned off or page is unloading */ clearInterval(interval); } else { if (self.GCION) { // have GCION, assume it's populated clearInterval(interval); if (isSet) { gcionSet(fn); } else { gcionGet(fn); } } } } if (self.GCION) { if (isSet) { gcionSet(fn); } else { gcionGet(fn); } } else { interval= setInterval(waitForIE, 50); } } function gciCallback(fn, doSet) { /* This is the start of, potentially, a two level chain of callbacks * First, we have to guarantee that the gciUsatURL has been loaded; * this should be a simple document.Write() of a couple script tags * but IE chokes unless it's given some time to calm down * -- zagitoExecuteWithGciUsat() handles this * Second, once that is loaded, we need to query gci's server * (doSet indicates which query we need) * -- gcionWill() handles this * Finally, when we've gotten the response from gci, we can run * the function named by fnName */ zagitoExecuteWithGciUsat(function() {gcionWill(fn, doSet)}); } /******************************** * execute after loading gciUsatURL * * (work around an IE problem) * ********************************/ var zagitoWillHaveGciUsat= 0; var zagitoHaveGciUsat= 0; var zagitoExecuteWithGciUsatList= []; function gciUsatLoadedCallback() { zagitoHaveGciUsat= 1; for (var j=0; j < zagitoExecuteWithGciUsatList.length; j++) { try { zagitoExecuteWithGciUsatList[j](); } catch(er) {} } } function zagitoExecuteWithGciUsat(fn) { if (!zagitoHaveGciUsat) { zagitoExecuteWithGciUsatList.push(fn); if (!zagitoWillHaveGciUsat) { var script= document.createElement('script'); script.setAttribute('language', 'javascript'); script.setAttribute('src', gciUsatURL); document.getElementsByTagName('head')[0].appendChild(script); zagitoWillHaveGciUsat= script; } } else { fn(); } } /************** * zagito support * **************/ var zagito= '-1'; function gci2Zagito(gcio) { if (gcio) { gcio.adr= null; var zagito= GCION.Sites.USAT.ParseZagito(getCookie('zagCookie')); if (gcio.gcionid) zagito.gci= gcio.gcionid; if (!GCION.Utils.Data.IsNullOrEmpty(gcio.zip)) { var status='GCI0'; zagito.version= 3; for (var p in gcio) if (GCION.Utils.Data.IsNullOrEmpty(zagito[p]) && 3 == p.length && (status='GCI' /*not a test*/)) if ('gen' == p) zagito['fem']= 2-gcio[p]; else zagito[p]= gcio[p]; zagito.gdt= zagito.gdt= nowDtNum(); zagito.sav= 0; GCION.Sites.USAT.SetZagito(zagito); postzagito(zagito, 'Saved'); setSessionCookie('zagSession', status); } else { GCION.Sites.USAT.SetZagito(zagito); if ('PreSync' == getCookie('zagSession')) { gciCallback(zagito2Gci, 1); setSessionCookie('zagSession', 'PreSynced'); } else if (-1 < (""+getCookie('rsi_seg')).indexOf('10378')) { setSessionCookie('zagSession', '0'); doLoadZagito(); } else { setSessionCookie('zagSession', 'Ready'); } } } else { setSessionCookie('zagSession', 'GCI Down'); } } function zagito2Gci(gcio) { if (gcio) { /* in principle, we have updated GCI with our zagito data */ var zagito= GCION.Sites.USAT.ParseZagito(getCookie('zagCookie')); zagito.gci= gcio.gcionid; zagito.gdt= nowDtNum(); zagito.sav= 0; GCION.Sites.USAT.SetZagito(zagito); setSessionCookie('zagSession', 'Synced'); if (!zagito.sav) { // sav: no postzagito(zagito, 'Saved It'); } } else { setSessionCookie('zagSession', 'GCI down'); } } function postzagito(data, finalState) { /* pack up GCION.Cookies.value into a query string, /* and tell postzagito about it */ if (!data.kcd) data.kcd= 'testzag2'; var url= zagitoPrefix+'/postzagito.ashx'; var delim='?'; for (p in data) if (3 == p.length) { url+=delim+escape(p)+'='+escape(data[p]); delim='&'; } var img= document.createElement('img'); img.onload= function() { var zs= ''+getCookie("zagSession"); /* double save to avoid browsers that are 'too smart' */ setSessionCookie("zagSession", finalState); if (-1 < zs.indexOf("error")) setSessionCookie("zagSession", zs); }; img.setAttribute('src', url); } function doLoadZagito() { var url= document.URL; if (!zagEnabled) return; if (-1==url.indexOf(".htm")) return; if (-1